layui.config({
	base : "js/"
}).use(['form','layer','jquery','laydate'],function(){
	var form = layui.form(),
		layer = parent.layer === undefined ? layui.layer : parent.layer,
		laypage = layui.laypage,
		layedit = layui.layedit,
		laydate = layui.laydate,
		$ = layui.jquery;

	form.on("submit(update)",function(data){
		//弹出loading
		var index = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});
		$.ajax({
			url:"/admin/update.do",
			data:JSON.stringify(data.field),
			contentType:"application/json;charset=utf-8",
			type:"post",
			success:function(data){
				top.layer.close(index);
				top.layer.msg("修改成功！");
				layer.closeAll("iframe");
				//刷新父页面
				parent.location.reload();
				return true;
			},
			error:function(){
				top.layer.close(index);
				top.layer.msg("修改成功！");
				layer.closeAll("iframe");
				//刷新父页面
				parent.location.reload();
				return false;
			}
		})

	})

})
